/*
 * AIStateManager.h
 *
 *  Created on: Sep 1, 2017
 *      Author: gaoyi
 */

#pragma once

#include "base/core/singleton.h"
#include "AIBaseState.h"

#include <vector>
#include <memory>


class AIStateManager : public ManualSingleton < AIStateManager >
{
	friend class ManualSingleton < AIStateManager > ;
public:
    AIStateManager();
    ~AIStateManager();

    /**
    *@brief  转换到指定状态
    *@param  [in] pCreature 对象
    *@param  [in] eState 指定状态
    *@param  [in] controller 转换状态的控制器
    *@return bool 转换成功返回true，否则返回false
    */
    bool ChangeState(Creature* pCreature, AIData* pAIData,const AIStateEnum eState, const int controller = AI_CONTROLLER_BASE);

    /**
    *@brief  获取当前状态对象
    *@param  [in] pCreature 对象
    *@return AIBaseState* 状态对象指针
    */
    AIBaseState* GetState(Creature* pCreature, AIData* pAIData);

private:
    std::vector<std::shared_ptr<AIBaseState>> m_pState;
};

#define g_MakeAIStateManager() (AIStateManager::Instance())
#define g_GetAIStateManager()  (AIStateManager::GetInstance())
#define g_DelAIStateManager()  (AIStateManager::Destroy())
